<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="vue.js"></script>
    <style type="text/css">
        span{
            display: inline-block ;
            width: 100px;
            text-align: center;
            text-decoration: none;
        }

        .color{
            background-color: red;
        }
    </style>
</head>
<body>
    

    <div id="app">
        <span :class="{color:index===num}" v-for="item,index in list" @click="red(index)">{{item}}</span>
    </div>


    <script type="text/javascript">
        var vm =new Vue({
            el: '#app',
            data: {
                num:'',
                list:["教父","阿甘正传","楚门的世界","盗梦空间"]
            },
            methods:{
                red(index){
                    this.num=index
                }
            }
        })

    </script>
</body>
</html>